<template>
  <qx-table :option="tableOption" :remoteData="remoteData"
            class="no-shadow no-padding bg-transparent non-margin-top q-mt-sm"></qx-table>
</template>

<script setup>
import { i18n } from 'boot/i18n'
import { computed, onMounted, ref } from 'vue'

const emits = defineEmits(['click'])

const remoteData = ref({ dicUrl: '/tpm/yfagv/api/cmMaintenanceStrategy/trigger/list' })
const tableOption = computed(() => {
  return {
    page: false, index: false,
    column: [{
      label: `${i18n.t('AGVCore.AGVCode')}`, field: 'equipmentNo', minWidth: 60
    }, {
      label: `${i18n.t('Misc.MaintenanceStatusTip1')}`, field: 'executing', minWidth: 60,
      cellClick: handleClick
    }]
  }
})

const handleClick = (_, col = {}) => {
  if (col.field !== 'executing') return
  const params = { action: 'tgr' }
  emits('click', params)
}
const startSearch = (_, done) => {
  remoteData.value.params = {}
  remoteData.value.clearSelected = true
  if (done) done()
}
onMounted(startSearch)
</script>